package com.algo.pattern.iterator;

public class IteratorTest {

    public static void main(String[] args) {
        Student stu1 = new Student("霍华德", 20);
        Student stu2 = new Student("哈登", 19);
        Student stu3 = new Student("姚明", 28);
        Student stu4 = new Student("科比", 24);
        Student stu5 = new Student("詹姆斯", 26);
        Student stu6 = new Student("安东尼", 25);
        Student stu7 = new Student("麦迪", 29);
        Student stu8 = new Student("保罗", 28);

        Classroom classroom = new Classroom();
        classroom.addStudent(stu1, stu2, stu3, stu4, stu5, stu6, stu7, stu8);

        Iterator<Student> iterator = classroom.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }

}
